# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:datetime1_0.py
@Time:2024/4/26 6:48

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""
from datetime import datetime, timedelta

def date_yesterday():
    # 获取今天的日期
    today = datetime.today()

    # 获取昨天的日期
    yesterday = today - timedelta(days=1)

    # 格式化昨天的日期
    # formatted_yesterday = yesterday.strftime("%Y-%m-%d")
    formatted_yesterday = yesterday.strftime("%Y%m%d")
    # print(type(formatted_yesterday))
    # print("昨天的日期是:", formatted_yesterday)
    return formatted_yesterday

# print(date_yesterday())

